import {request} from "../../utils/http/index"
import {LoginParams} from "../../app/slice/userSlice";

export const reqLogin = async (username:string,password:string)=>{
    try{
        // urlencoded : request.post<any,any>("url","username=admin&password=123456&token="
        //json
        let result = await request.post<any,any>("/login",{
            username,
            password,
            //token一定都要判断,tonken中有过期时间
            token : localStorage.getItem("token") || "",
        });

        //返回token
        return result
    }catch (e) {
        console.log("src/api/user/index:",e);
    }
}